/*INSERTION_TRADOIL*/
/**********************************************************************************************************************/
/* !Layer           : SRVL                                                                                            */
/* !Component       : RTMCLD                                                                                          */
/* !Description     : Real time measurement of CPU load                                                               */
/*                                                                                                                    */
/* !File            : RTMCLD_CHK.TPL                                                                                  */
/* !Description     : configurations of the RTMCLD component                                                          */
/*                                                                                                                    */
/* !Reference       : PTS_DOC_5385380                                                                                 */
/*                                                                                                                    */
/* Coding language  : OIL                                                                                             */
/*                                                                                                                    */
/* COPYRIGHT VALEO all rights reserved                                                                                */
/**********************************************************************************************************************/
/* Dimension Informations
 * %PCMS_HEADER_SUBSTITUTION_START:%
 * The PID has this format: <Product ID>:<Item ID>.<Variant>-<Item Type>;<Revision>
 * %PID:%
 * %PCMS_HEADER_SUBSTITUTION_END:%
 **********************************************************************************************************************/
'/**********************************************************************************************************************/
/* !Layer           : SRVL                                                                                            */
/* !Component       : RTMCLD                                                                                          */
/* !Description     : Real time measurement of CPU load                                                               */
/*                                                                                                                    */
/* !File            : RTMCLD_CHK.TXT                                                                                  */
/* !Description     : configurations of the RTMCLD component                                                          */
/*                                                                                                                    */
/* !Reference       : PTS_DOC_5385380                                                                                 */
/*                                                                                                                    */
/* Coding language  : C                                                                                               */
/*                                                                                                                    */
/* COPYRIGHT VALEO all rights reserved                                                                                */
/**********************************************************************************************************************/
/* `Date()': generated by Genecode  `Version()'                                                                       */
/* From Source Template : RTMCLD_CHK.TPL                                                                              */
/**********************************************************************************************************************/
`


/**********************************************************************************************************************/
/* Make sure that there is only one RTMCLD_CFG object                                                                 */
/**********************************************************************************************************************/

TRADOIL WHERE ( .RTMCLD_CFG COUNT  != 1)
{
    Error(("RTMCLD-E001: There must be one and only one RTMCLD_CFG object, now there is ".RTMCLD_CFG COUNT" "))
}


/**********************************************************************************************************************/
/* Main Function Consistencies Checks                                                                                 */
/* If the MainFunction is needing, then its period shall not be null                                                  */
/**********************************************************************************************************************/
RTMCLD_CFG WHERE( MAIN_FUNCTION_PERIOD_MS == 0.0)
{
   Error((" RTMCLD_E002 : The MAIN_FUNCTION_PERIOD_US field shall be defined in RTMCLD_CFG object with a none null value."))
}


RTMCLD_CFG
{
   WHERE((( CPU_LOAD_MEASUREMENT_PERIOD_MS) % ( MAIN_FUNCTION_PERIOD_MS)) == 0 )
   {
      (((  CPU_LOAD_MEASUREMENT_PERIOD_MS) / ( MAIN_FUNCTION_PERIOD_MS)) ) INTO  MEASUREMENT_PERIOD_IN_TICKS_OF_MAIN
   }

    WHERE((( CPU_LOAD_MEASUREMENT_PERIOD_MS) % ( MAIN_FUNCTION_PERIOD_MS)) != 0 )
    {
       Error((" RTMCLD_E003 : As CPU load measuremnt shall be accurate, CPU_LOAD_MEASUREMENT_PERIOD_MS shall be a multiple of the main function period."))
    }
}

RTMCLD_CFG WHERE(MEASUREMENT_PERIOD_IN_TICKS_OF_MAIN > 65535)
{
  Error((" RTMCLD_E004 : The number of ticks of mainFunction in the measurement period shall not exceed 65535."))
}


/**********************************************************************************************************************/
/* MEASUREMENT_PERIOD Name    to point                                                                                  */
/**********************************************************************************************************************/
/* This section computes the name of measurement period, regarding the                                                */
/*   CONFIG_TYPE (PREBUILD, POSTBUILD, RUNTIME) define in RTMCLD_CFG object                                           */
/**********************************************************************************************************************/
 RTMCLD_CFG AS cfg WHERE((CPU_LOAD_MEASUREMENT_PERIOD_CONFIG_TYPE =="POSTBUILD")or(CPU_LOAD_MEASUREMENT_PERIOD_CONFIG_TYPE =="RUNTIME"))
{
/*     CPU_LOAD_MEASUREMENT_PERIOD_NAME shall not be empty                                      */
   .TRADOIL WHERE( cfg.CPU_LOAD_MEASUREMENT_PERIOD_NAME=="")
   {
       Error(("RTMCLD_E005: The CPU_LOAD_MEASUREMENT_PERIOD_NAME field shall be defined because CPU_LOAD_MEASUREMENT_PERIOD_CONFIG_TYPE is not = PREBUILD in RTMCLD_CFG object."))
   }

}



/* CPU_LOAD_MEASUREMENT_PERIOD_MS shall not be empty                                      */
RTMCLD_CFG  WHERE( CPU_LOAD_MEASUREMENT_PERIOD_MS==0)
{
   Error(("RTMCLD_E006: The CPU_LOAD_MEASUREMENT_PERIOD_MS field shall be defined as in case of CPU_LOAD_MEASUREMENT_PERIOD_CONFIG_TYPE is = PREBUILD in RTMCLD_CFG object this value will be used to calculate the number of mainFunctions within the period and in case of CPU_LOAD_MEASUREMENT_PERIOD_CONFIG_TYPE is = POSTBUILD or RUNTIME it will be used as a default value to avoid bad values in RUNTIME or POSTBUILD ."))
}



/* ENDLESS_LOOP_EXECUTION_TIME_NS shall not be more than 65535                                                    */
RTMCLD_CFG  WHERE( ENDLESS_LOOP_EXECUTION_TIME_NS>65535)
{
   Error(("RTMCLD_E007: The ENDLESS_LOOP_EXECUTION_TIME_NS field value shall not be more than 65535 (65.5 us) ."))
}

RTMCLD_CFG WHERE( ENDLESS_LOOP_EXECUTION_TIME_NS== 0)
{
   Error(("RTMCLD_E008: The ENDLESS_LOOP_EXECUTION_TIME_NS field value shall not be = zero ."))
}




'0 Error for RTMCLD Configuration`

/*---------------------------------------------------- end of file ---------------------------------------------------*/
